using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Widgetsphere.Northwind.DataTransfer;
using Widgetsphere.Northwind.DataTransfer.Extensions;
using Widgetsphere.Core.Util;

namespace Widgetsphere.Northwind.WCFService
{
	// NOTE: If you change the class name "DataService" here, you must also update the reference to "DataService" in Web.config and in the associated .svc file.
	public class DataService : IDataService
	{
		#region Category Select All

		public List<CategoryDTO> GetCategoryList()
		{
			List<CategoryDTO> retval = new List<CategoryDTO>();
			retval.RunSelect();
			return retval;
		}

		#endregion

		#region Category Select By Primary Key

		public CategoryDTO GetCategory(int categoryid)
		{
			CategoryDTO retVal = new CategoryDTO();
			retVal.SelectUsingPK(categoryid);
			return retVal;
		}

		#endregion

		#region Category select paged

		public PagedQueryResults<CategoryDTO> GetCategoryListPaged(int pageIndex, int pageSize, bool sortOrder, string sortColumn, string linq)
		{
			List<CategoryDTO> dtoList = new List<CategoryDTO>();
			return dtoList.RunSelect(pageSize.ToString(), pageIndex.ToString(), sortOrder.ToString().ToLower(), sortColumn, linq);
		}

		#endregion

		#region Category Select by LINQ

		public List<CategoryDTO> GetCategoryListByLINQ(string linq)
		{
			List<CategoryDTO> dtoList = new List<CategoryDTO>();
			dtoList.RunSelect(linq);
			return dtoList;
		}

		#endregion

		#region Category Select by Column

		#endregion

		#region Category Select By Foreign Key

		#endregion

		#region Category Add Item

		public CategoryDTO PersistCategory(CategoryDTO item)
		{
			return item.Persist();
		}

		#endregion

		#region Customer Select All

		public List<CustomerDTO> GetCustomerList()
		{
			List<CustomerDTO> retval = new List<CustomerDTO>();
			retval.RunSelect();
			return retval;
		}

		#endregion

		#region Customer Select By Primary Key

		public CustomerDTO GetCustomer(int userid)
		{
			CustomerDTO retVal = new CustomerDTO();
			retVal.SelectUsingPK(userid);
			return retVal;
		}

		#endregion

		#region Customer select paged

		public PagedQueryResults<CustomerDTO> GetCustomerListPaged(int pageIndex, int pageSize, bool sortOrder, string sortColumn, string linq)
		{
			List<CustomerDTO> dtoList = new List<CustomerDTO>();
			return dtoList.RunSelect(pageSize.ToString(), pageIndex.ToString(), sortOrder.ToString().ToLower(), sortColumn, linq);
		}

		#endregion

		#region Customer Select by LINQ

		public List<CustomerDTO> GetCustomerListByLINQ(string linq)
		{
			List<CustomerDTO> dtoList = new List<CustomerDTO>();
			dtoList.RunSelect(linq);
			return dtoList;
		}

		#endregion

		#region Customer Select by Column

		#endregion

		#region Customer Select By Foreign Key

		#endregion

		#region Customer Add Item

		public CustomerDTO PersistCustomer(CustomerDTO item)
		{
			return item.Persist();
		}

		#endregion

		#region Employee Select All

		public List<EmployeeDTO> GetEmployeeList()
		{
			List<EmployeeDTO> retval = new List<EmployeeDTO>();
			retval.RunSelect();
			return retval;
		}

		#endregion

		#region Employee Select By Primary Key

		public EmployeeDTO GetEmployee(int userid)
		{
			EmployeeDTO retVal = new EmployeeDTO();
			retVal.SelectUsingPK(userid);
			return retVal;
		}

		#endregion

		#region Employee select paged

		public PagedQueryResults<EmployeeDTO> GetEmployeeListPaged(int pageIndex, int pageSize, bool sortOrder, string sortColumn, string linq)
		{
			List<EmployeeDTO> dtoList = new List<EmployeeDTO>();
			return dtoList.RunSelect(pageSize.ToString(), pageIndex.ToString(), sortOrder.ToString().ToLower(), sortColumn, linq);
		}

		#endregion

		#region Employee Select by LINQ

		public List<EmployeeDTO> GetEmployeeListByLINQ(string linq)
		{
			List<EmployeeDTO> dtoList = new List<EmployeeDTO>();
			dtoList.RunSelect(linq);
			return dtoList;
		}

		#endregion

		#region Employee Select by Column

		#endregion

		#region Employee Select By Foreign Key

		public List<EmployeeDTO> GetEmployeeByEmployee(int userid)
		{
			List<EmployeeDTO> retval = new List<EmployeeDTO>();
			retval.SelectByEmployee(userid);
			return retval;
		}

		#endregion

		#region Employee Add Item

		public EmployeeDTO PersistEmployee(EmployeeDTO item)
		{
			return item.Persist();
		}

		#endregion

		#region EmployeeTerritory Select All

		public List<EmployeeTerritoryDTO> GetEmployeeTerritoryList()
		{
			List<EmployeeTerritoryDTO> retval = new List<EmployeeTerritoryDTO>();
			retval.RunSelect();
			return retval;
		}

		#endregion

		#region EmployeeTerritory Select By Primary Key

		public EmployeeTerritoryDTO GetEmployeeTerritory(int userid, string territoryid)
		{
			EmployeeTerritoryDTO retVal = new EmployeeTerritoryDTO();
			retVal.SelectUsingPK(userid, territoryid);
			return retVal;
		}

		#endregion

		#region EmployeeTerritory select paged

		public PagedQueryResults<EmployeeTerritoryDTO> GetEmployeeTerritoryListPaged(int pageIndex, int pageSize, bool sortOrder, string sortColumn, string linq)
		{
			List<EmployeeTerritoryDTO> dtoList = new List<EmployeeTerritoryDTO>();
			return dtoList.RunSelect(pageSize.ToString(), pageIndex.ToString(), sortOrder.ToString().ToLower(), sortColumn, linq);
		}

		#endregion

		#region EmployeeTerritory Select by LINQ

		public List<EmployeeTerritoryDTO> GetEmployeeTerritoryListByLINQ(string linq)
		{
			List<EmployeeTerritoryDTO> dtoList = new List<EmployeeTerritoryDTO>();
			dtoList.RunSelect(linq);
			return dtoList;
		}

		#endregion

		#region EmployeeTerritory Select by Column

		#endregion

		#region EmployeeTerritory Select By Foreign Key

		public List<EmployeeTerritoryDTO> GetEmployeeTerritoryByTerritory(string territoryid)
		{
			List<EmployeeTerritoryDTO> retval = new List<EmployeeTerritoryDTO>();
			retval.SelectByTerritory(territoryid);
			return retval;
		}

		public List<EmployeeTerritoryDTO> GetEmployeeTerritoryByEmployee(int userid)
		{
			List<EmployeeTerritoryDTO> retval = new List<EmployeeTerritoryDTO>();
			retval.SelectByEmployee(userid);
			return retval;
		}

		#endregion

		#region EmployeeTerritory Add Item

		public EmployeeTerritoryDTO PersistEmployeeTerritory(EmployeeTerritoryDTO item)
		{
			return item.Persist();
		}

		#endregion

		#region Order Select All

		public List<OrderDTO> GetOrderList()
		{
			List<OrderDTO> retval = new List<OrderDTO>();
			retval.RunSelect();
			return retval;
		}

		#endregion

		#region Order Select By Primary Key

		public OrderDTO GetOrder(int orderid)
		{
			OrderDTO retVal = new OrderDTO();
			retVal.SelectUsingPK(orderid);
			return retVal;
		}

		#endregion

		#region Order select paged

		public PagedQueryResults<OrderDTO> GetOrderListPaged(int pageIndex, int pageSize, bool sortOrder, string sortColumn, string linq)
		{
			List<OrderDTO> dtoList = new List<OrderDTO>();
			return dtoList.RunSelect(pageSize.ToString(), pageIndex.ToString(), sortOrder.ToString().ToLower(), sortColumn, linq);
		}

		#endregion

		#region Order Select by LINQ

		public List<OrderDTO> GetOrderListByLINQ(string linq)
		{
			List<OrderDTO> dtoList = new List<OrderDTO>();
			dtoList.RunSelect(linq);
			return dtoList;
		}

		#endregion

		#region Order Select by Column

		#endregion

		#region Order Select By Foreign Key

		public List<OrderDTO> GetOrderByCustomer(int userid)
		{
			List<OrderDTO> retval = new List<OrderDTO>();
			retval.SelectByCustomer(userid);
			return retval;
		}

		public List<OrderDTO> GetOrderByShipper(int shipperid)
		{
			List<OrderDTO> retval = new List<OrderDTO>();
			retval.SelectByShipper(shipperid);
			return retval;
		}

		public List<OrderDTO> GetOrderByEmployee(int userid)
		{
			List<OrderDTO> retval = new List<OrderDTO>();
			retval.SelectByEmployee(userid);
			return retval;
		}

		#endregion

		#region Order Add Item

		public OrderDTO PersistOrder(OrderDTO item)
		{
			return item.Persist();
		}

		#endregion

		#region OrderDetail Select All

		public List<OrderDetailDTO> GetOrderDetailList()
		{
			List<OrderDetailDTO> retval = new List<OrderDetailDTO>();
			retval.RunSelect();
			return retval;
		}

		#endregion

		#region OrderDetail Select By Primary Key

		public OrderDetailDTO GetOrderDetail(int orderdetailid)
		{
			OrderDetailDTO retVal = new OrderDetailDTO();
			retVal.SelectUsingPK(orderdetailid);
			return retVal;
		}

		#endregion

		#region OrderDetail select paged

		public PagedQueryResults<OrderDetailDTO> GetOrderDetailListPaged(int pageIndex, int pageSize, bool sortOrder, string sortColumn, string linq)
		{
			List<OrderDetailDTO> dtoList = new List<OrderDetailDTO>();
			return dtoList.RunSelect(pageSize.ToString(), pageIndex.ToString(), sortOrder.ToString().ToLower(), sortColumn, linq);
		}

		#endregion

		#region OrderDetail Select by LINQ

		public List<OrderDetailDTO> GetOrderDetailListByLINQ(string linq)
		{
			List<OrderDetailDTO> dtoList = new List<OrderDetailDTO>();
			dtoList.RunSelect(linq);
			return dtoList;
		}

		#endregion

		#region OrderDetail Select by Column

		#endregion

		#region OrderDetail Select By Foreign Key

		public List<OrderDetailDTO> GetOrderDetailByOrder(int orderid)
		{
			List<OrderDetailDTO> retval = new List<OrderDetailDTO>();
			retval.SelectByOrder(orderid);
			return retval;
		}

		public List<OrderDetailDTO> GetOrderDetailByProduct(int productid)
		{
			List<OrderDetailDTO> retval = new List<OrderDetailDTO>();
			retval.SelectByProduct(productid);
			return retval;
		}

		#endregion

		#region OrderDetail Add Item

		public OrderDetailDTO PersistOrderDetail(OrderDetailDTO item)
		{
			return item.Persist();
		}

		#endregion

		#region Product Select All

		public List<ProductDTO> GetProductList()
		{
			List<ProductDTO> retval = new List<ProductDTO>();
			retval.RunSelect();
			return retval;
		}

		#endregion

		#region Product Select By Primary Key

		public ProductDTO GetProduct(int productid)
		{
			ProductDTO retVal = new ProductDTO();
			retVal.SelectUsingPK(productid);
			return retVal;
		}

		#endregion

		#region Product select paged

		public PagedQueryResults<ProductDTO> GetProductListPaged(int pageIndex, int pageSize, bool sortOrder, string sortColumn, string linq)
		{
			List<ProductDTO> dtoList = new List<ProductDTO>();
			return dtoList.RunSelect(pageSize.ToString(), pageIndex.ToString(), sortOrder.ToString().ToLower(), sortColumn, linq);
		}

		#endregion

		#region Product Select by LINQ

		public List<ProductDTO> GetProductListByLINQ(string linq)
		{
			List<ProductDTO> dtoList = new List<ProductDTO>();
			dtoList.RunSelect(linq);
			return dtoList;
		}

		#endregion

		#region Product Select by Column

		#endregion

		#region Product Select By Foreign Key

		public List<ProductDTO> GetProductByCategory(int categoryid)
		{
			List<ProductDTO> retval = new List<ProductDTO>();
			retval.SelectByCategory(categoryid);
			return retval;
		}

		public List<ProductDTO> GetProductBySupplier(int userid)
		{
			List<ProductDTO> retval = new List<ProductDTO>();
			retval.SelectBySupplier(userid);
			return retval;
		}

		#endregion

		#region Product Add Item

		public ProductDTO PersistProduct(ProductDTO item)
		{
			return item.Persist();
		}

		#endregion

		#region Region Select All

		public List<RegionDTO> GetRegionList()
		{
			List<RegionDTO> retval = new List<RegionDTO>();
			retval.RunSelect();
			return retval;
		}

		#endregion

		#region Region Select By Primary Key

		public RegionDTO GetRegion(int regionid)
		{
			RegionDTO retVal = new RegionDTO();
			retVal.SelectUsingPK(regionid);
			return retVal;
		}

		#endregion

		#region Region select paged

		public PagedQueryResults<RegionDTO> GetRegionListPaged(int pageIndex, int pageSize, bool sortOrder, string sortColumn, string linq)
		{
			List<RegionDTO> dtoList = new List<RegionDTO>();
			return dtoList.RunSelect(pageSize.ToString(), pageIndex.ToString(), sortOrder.ToString().ToLower(), sortColumn, linq);
		}

		#endregion

		#region Region Select by LINQ

		public List<RegionDTO> GetRegionListByLINQ(string linq)
		{
			List<RegionDTO> dtoList = new List<RegionDTO>();
			dtoList.RunSelect(linq);
			return dtoList;
		}

		#endregion

		#region Region Select by Column

		#endregion

		#region Region Select By Foreign Key

		#endregion

		#region Region Add Item

		public RegionDTO PersistRegion(RegionDTO item)
		{
			return item.Persist();
		}

		#endregion

		#region Shipper Select All

		public List<ShipperDTO> GetShipperList()
		{
			List<ShipperDTO> retval = new List<ShipperDTO>();
			retval.RunSelect();
			return retval;
		}

		#endregion

		#region Shipper Select By Primary Key

		public ShipperDTO GetShipper(int shipperid)
		{
			ShipperDTO retVal = new ShipperDTO();
			retVal.SelectUsingPK(shipperid);
			return retVal;
		}

		#endregion

		#region Shipper select paged

		public PagedQueryResults<ShipperDTO> GetShipperListPaged(int pageIndex, int pageSize, bool sortOrder, string sortColumn, string linq)
		{
			List<ShipperDTO> dtoList = new List<ShipperDTO>();
			return dtoList.RunSelect(pageSize.ToString(), pageIndex.ToString(), sortOrder.ToString().ToLower(), sortColumn, linq);
		}

		#endregion

		#region Shipper Select by LINQ

		public List<ShipperDTO> GetShipperListByLINQ(string linq)
		{
			List<ShipperDTO> dtoList = new List<ShipperDTO>();
			dtoList.RunSelect(linq);
			return dtoList;
		}

		#endregion

		#region Shipper Select by Column

		#endregion

		#region Shipper Select By Foreign Key

		#endregion

		#region Shipper Add Item

		public ShipperDTO PersistShipper(ShipperDTO item)
		{
			return item.Persist();
		}

		#endregion

		#region Supplier Select All

		public List<SupplierDTO> GetSupplierList()
		{
			List<SupplierDTO> retval = new List<SupplierDTO>();
			retval.RunSelect();
			return retval;
		}

		#endregion

		#region Supplier Select By Primary Key

		public SupplierDTO GetSupplier(int userid)
		{
			SupplierDTO retVal = new SupplierDTO();
			retVal.SelectUsingPK(userid);
			return retVal;
		}

		#endregion

		#region Supplier select paged

		public PagedQueryResults<SupplierDTO> GetSupplierListPaged(int pageIndex, int pageSize, bool sortOrder, string sortColumn, string linq)
		{
			List<SupplierDTO> dtoList = new List<SupplierDTO>();
			return dtoList.RunSelect(pageSize.ToString(), pageIndex.ToString(), sortOrder.ToString().ToLower(), sortColumn, linq);
		}

		#endregion

		#region Supplier Select by LINQ

		public List<SupplierDTO> GetSupplierListByLINQ(string linq)
		{
			List<SupplierDTO> dtoList = new List<SupplierDTO>();
			dtoList.RunSelect(linq);
			return dtoList;
		}

		#endregion

		#region Supplier Select by Column

		#endregion

		#region Supplier Select By Foreign Key

		#endregion

		#region Supplier Add Item

		public SupplierDTO PersistSupplier(SupplierDTO item)
		{
			return item.Persist();
		}

		#endregion

		#region SystemUser Select All

		public List<SystemUserDTO> GetSystemUserList()
		{
			List<SystemUserDTO> retval = new List<SystemUserDTO>();
			retval.RunSelect();
			return retval;
		}

		#endregion

		#region SystemUser Select By Primary Key

		public SystemUserDTO GetSystemUser(int userid)
		{
			SystemUserDTO retVal = new SystemUserDTO();
			retVal.SelectUsingPK(userid);
			return retVal;
		}

		#endregion

		#region SystemUser select paged

		public PagedQueryResults<SystemUserDTO> GetSystemUserListPaged(int pageIndex, int pageSize, bool sortOrder, string sortColumn, string linq)
		{
			List<SystemUserDTO> dtoList = new List<SystemUserDTO>();
			return dtoList.RunSelect(pageSize.ToString(), pageIndex.ToString(), sortOrder.ToString().ToLower(), sortColumn, linq);
		}

		#endregion

		#region SystemUser Select by LINQ

		public List<SystemUserDTO> GetSystemUserListByLINQ(string linq)
		{
			List<SystemUserDTO> dtoList = new List<SystemUserDTO>();
			dtoList.RunSelect(linq);
			return dtoList;
		}

		#endregion

		#region SystemUser Select by Column

		#endregion

		#region SystemUser Select By Foreign Key

		#endregion

		#region SystemUser Add Item

		#endregion

		#region Territory Select All

		public List<TerritoryDTO> GetTerritoryList()
		{
			List<TerritoryDTO> retval = new List<TerritoryDTO>();
			retval.RunSelect();
			return retval;
		}

		#endregion

		#region Territory Select By Primary Key

		public TerritoryDTO GetTerritory(string territoryid)
		{
			TerritoryDTO retVal = new TerritoryDTO();
			retVal.SelectUsingPK(territoryid);
			return retVal;
		}

		#endregion

		#region Territory select paged

		public PagedQueryResults<TerritoryDTO> GetTerritoryListPaged(int pageIndex, int pageSize, bool sortOrder, string sortColumn, string linq)
		{
			List<TerritoryDTO> dtoList = new List<TerritoryDTO>();
			return dtoList.RunSelect(pageSize.ToString(), pageIndex.ToString(), sortOrder.ToString().ToLower(), sortColumn, linq);
		}

		#endregion

		#region Territory Select by LINQ

		public List<TerritoryDTO> GetTerritoryListByLINQ(string linq)
		{
			List<TerritoryDTO> dtoList = new List<TerritoryDTO>();
			dtoList.RunSelect(linq);
			return dtoList;
		}

		#endregion

		#region Territory Select by Column

		#endregion

		#region Territory Select By Foreign Key

		public List<TerritoryDTO> GetTerritoryByRegion(int regionid)
		{
			List<TerritoryDTO> retval = new List<TerritoryDTO>();
			retval.SelectByRegion(regionid);
			return retval;
		}

		#endregion

		#region Territory Add Item

		public TerritoryDTO PersistTerritory(TerritoryDTO item)
		{
			return item.Persist();
		}

		#endregion

	}

}
